from pydantic import ValidationError

from datetime import datetime
from typing import List
from pydantic import BaseModel


class User(BaseModel):
    """参数类型校验"""
    id: int
    name = 'jack guo'
    signup_timestamp: datetime = None
    friends: List[int] = []


try:
    User(id=1, name='ks', signup_timestamp=datetime.now(), friends=[1, 2, 3, 'hello'])
except ValidationError as e:
    print(e.json())
